Fix some more pfn/mfn/gmfn/gpfn inconsistencies. Fix some direct
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 2 Feb 2006 11:18:28 +0000 (12:18 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 2 Feb 2006 11:18:28 +0000 (12:18 +0100)
uses of max_page variable to use the mfn_valid() predicate.

Signed-off-by: Keir Fraser <keir@xensource.com>
29 files changed:
linux-2.6-xen-sparse/arch/i386/kernel/cpu/mtrr/main-xen.c
tools/libxc/xc_domain.c
tools/libxc/xc_linux_build.c
tools/libxc/xc_private.c
tools/libxc/xenctrl.h
xen/arch/x86/audit.c
xen/arch/x86/dom0_ops.c
xen/arch/x86/domain_build.c
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/hvm/vmx/vmx.c
xen/arch/x86/mm.c
xen/arch/x86/shadow32.c
xen/arch/x86/shadow_public.c
xen/arch/x86/x86_32/mm.c
xen/arch/x86/x86_32/traps.c
xen/common/dom0_ops.c
xen/common/grant_table.c
xen/common/memory.c
xen/include/asm-ia64/config.h
xen/include/asm-ia64/mm.h
xen/include/asm-x86/grant_table.h
xen/include/asm-x86/hvm/io.h
xen/include/asm-x86/mm.h
xen/include/asm-x86/shadow.h
xen/include/asm-x86/shadow_64.h
xen/include/public/dom0_ops.h
xen/include/public/memory.h
xen/include/xen/perfc_defn.h

index 1cf75f3d8537102a44705c6565f071f91f916d32..407cc78b7c40ca6e3a38de5663ae8eb6bf97ad9f 100644 (file)
@@ -17,8 +17,8 @@ void generic_get_mtrr(unsigned int reg, unsigned long *base,
        op.u.read_memtype.reg = reg;
        (void)HYPERVISOR_dom0_op(&op);
 
-       *size = op.u.read_memtype.nr_pfns;
-       *base = op.u.read_memtype.pfn;
+       *size = op.u.read_memtype.nr_mfns;
+       *base = op.u.read_memtype.mfn;
        *type = op.u.read_memtype.type;
 }
 
@@ -64,8 +64,8 @@ int mtrr_add_page(unsigned long base, unsigned long size,
        dom0_op_t op;
 
        op.cmd = DOM0_ADD_MEMTYPE;
-       op.u.add_memtype.pfn     = base;
-       op.u.add_memtype.nr_pfns = size;
+       op.u.add_memtype.mfn     = base;
+       op.u.add_memtype.nr_mfns = size;
        op.u.add_memtype.type    = type;
        error = HYPERVISOR_dom0_op(&op);
        if (error) {
index aae3236695479db1c58433d45e3aa1dc26808fa9..89bdb86e5dcf58baf948094a3d7f0a7682afb0cc 100644 (file)
@@ -421,16 +421,16 @@ int xc_domain_irq_permission(int xc_handle,
 
 int xc_domain_iomem_permission(int xc_handle,
                                uint32_t domid,
-                               unsigned long first_pfn,
-                               unsigned long nr_pfns,
+                               unsigned long first_mfn,
+                               unsigned long nr_mfns,
                                uint8_t allow_access)
 {
     dom0_op_t op;
 
     op.cmd = DOM0_IOMEM_PERMISSION;
     op.u.iomem_permission.domain = domid;
-    op.u.iomem_permission.first_pfn = first_pfn;
-       op.u.iomem_permission.nr_pfns = nr_pfns;
+    op.u.iomem_permission.first_mfn = first_mfn;
+       op.u.iomem_permission.nr_mfns = nr_mfns;
     op.u.iomem_permission.allow_access = allow_access;
 
     return do_dom0_op(xc_handle, &op);
index f90f509f2c44bba0fbc6fcb6146641d64ce2cd21..6a188196141114535ed5a03e5fa3b1e1758bde61 100644 (file)
@@ -767,7 +767,7 @@ static int setup_guest(int xc_handle,
             PERROR("Cannot find shared info pfn");
             goto error_out;
         }
-        guest_shared_info_mfn = xrpa.first_pfn;
+        guest_shared_info_mfn = xrpa.first_gpfn;
     }
     else
     {
index 6b58e1ddf25accedcbfced9f4d22e688cd781002..70d5d6829af873b9effc60a55853926ba06c9aca 100644 (file)
@@ -83,7 +83,7 @@ unsigned int get_pfn_type(int xc_handle,
 {
     DECLARE_DOM0_OP;
     op.cmd = DOM0_GETPAGEFRAMEINFO;
-    op.u.getpageframeinfo.pfn    = mfn;
+    op.u.getpageframeinfo.mfn    = mfn;
     op.u.getpageframeinfo.domain = (domid_t)dom;
     if ( do_dom0_op(xc_handle, &op) < 0 )
     {
index 91d717c55c7ea20cc8fe9303458329f5496f2ace..dc6a9c0f83dd68edfff6059375c239f3ea2b808f 100644 (file)
@@ -386,8 +386,8 @@ int xc_domain_irq_permission(int xc_handle,
 
 int xc_domain_iomem_permission(int xc_handle,
                                uint32_t domid,
-                               unsigned long first_pfn,
-                               unsigned long nr_pfns,
+                               unsigned long first_mfn,
+                               unsigned long nr_mfns,
                                uint8_t allow_access);
 
 unsigned long xc_make_page_below_4G(int xc_handle, uint32_t domid, 
index 0427f553357ee5569733496a6a0c4fe97cc73905..b0bba0daa3ce3768cad6dbb827a9a384be2c27b0 100644 (file)
@@ -239,16 +239,16 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
         {
             if ( l2e_get_flags(pt[i]) & _PAGE_PRESENT )
             {
-                unsigned long gmfn = l2e_get_pfn(pt[i]);
-                struct page_info *gpage = mfn_to_page(gmfn);
+                unsigned long mfn = l2e_get_pfn(pt[i]);
+                struct page_info *gpage = mfn_to_page(mfn);
 
-                if ( gmfn < 0x100 )
+                if ( mfn < 0x100 )
                 {
                     lowmem_mappings++;
                     continue;
                 }
 
-                if ( gmfn > max_page )
+                if ( !mfn_valid(mfn) )
                 {
                     io_mappings++;
                     continue;
@@ -264,7 +264,7 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
                                d->domain_id, hl2mfn, i,
                                page_get_owner(gpage),
                                page_get_owner(gpage)->domain_id,
-                               gmfn,
+                               mfn,
                                gpage->count_info,
                                gpage->u.inuse.type_info);
                         continue;
@@ -286,16 +286,16 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
         {
             if ( l1e_get_flags(pt[i]) & _PAGE_PRESENT )
             {
-                unsigned long gmfn = l1e_get_pfn(pt[i]);
-                struct page_info *gpage = mfn_to_page(gmfn);
+                unsigned long mfn = l1e_get_pfn(pt[i]);
+                struct page_info *gpage = mfn_to_page(mfn);
 
-                if ( gmfn < 0x100 )
+                if ( mfn < 0x100 )
                 {
                     lowmem_mappings++;
                     continue;
                 }
 
-                if ( gmfn > max_page )
+                if ( !mfn_valid(mfn) )
                 {
                     io_mappings++;
                     continue;
@@ -313,7 +313,7 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
                             printk("Audit %d: [l1mfn=%lx, i=%x] Illegal RW "
                                    "t=%" PRtype_info " mfn=%lx\n",
                                    d->domain_id, l1mfn, i,
-                                   gpage->u.inuse.type_info, gmfn);
+                                   gpage->u.inuse.type_info, mfn);
                             errors++;
                         }
 
@@ -322,8 +322,8 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
                              ! page_out_of_sync(gpage) )
                         {
                             printk("Audit %d: [l1mfn=%lx, i=%x] Illegal RW of "
-                                   "page table gmfn=%lx\n",
-                                   d->domain_id, l1mfn, i, gmfn);
+                                   "page table mfn=%lx\n",
+                                   d->domain_id, l1mfn, i, mfn);
                             errors++;
                         }
                     }             
@@ -336,7 +336,7 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
                                d->domain_id, l1mfn, i,
                                page_get_owner(gpage),
                                page_get_owner(gpage)->domain_id,
-                               gmfn,
+                               mfn,
                                gpage->count_info,
                                gpage->u.inuse.type_info);
                         continue;
index f12272f0a04aa8109ba569d14d46bec05632c08d..2629fa36719f5b0a86a241393ed6ac4d23d78f43 100644 (file)
@@ -98,8 +98,8 @@ long arch_do_dom0_op(struct dom0_op *op, struct dom0_op *u_dom0_op)
     case DOM0_ADD_MEMTYPE:
     {
         ret = mtrr_add_page(
-            op->u.add_memtype.pfn,
-            op->u.add_memtype.nr_pfns,
+            op->u.add_memtype.mfn,
+            op->u.add_memtype.nr_mfns,
             op->u.add_memtype.type,
             1);
         if (ret > 0)
@@ -128,16 +128,16 @@ long arch_do_dom0_op(struct dom0_op *op, struct dom0_op *u_dom0_op)
 
     case DOM0_READ_MEMTYPE:
     {
-        unsigned long pfn;
-        unsigned int  nr_pfns;
+        unsigned long mfn;
+        unsigned int  nr_mfns;
         mtrr_type     type;
 
         ret = -EINVAL;
         if ( op->u.read_memtype.reg < num_var_ranges )
         {
-            mtrr_if->get(op->u.read_memtype.reg, &pfn, &nr_pfns, &type);
-            (void)__put_user(pfn, &u_dom0_op->u.read_memtype.pfn);
-            (void)__put_user(nr_pfns, &u_dom0_op->u.read_memtype.nr_pfns);
+            mtrr_if->get(op->u.read_memtype.reg, &mfn, &nr_mfns, &type);
+            (void)__put_user(mfn, &u_dom0_op->u.read_memtype.mfn);
+            (void)__put_user(nr_mfns, &u_dom0_op->u.read_memtype.nr_mfns);
             (void)__put_user(type, &u_dom0_op->u.read_memtype.type);
             ret = 0;
         }
@@ -200,17 +200,17 @@ long arch_do_dom0_op(struct dom0_op *op, struct dom0_op *u_dom0_op)
     case DOM0_GETPAGEFRAMEINFO:
     {
         struct page_info *page;
-        unsigned long pfn = op->u.getpageframeinfo.pfn;
+        unsigned long mfn = op->u.getpageframeinfo.mfn;
         domid_t dom = op->u.getpageframeinfo.domain;
         struct domain *d;
 
         ret = -EINVAL;
 
-        if ( unlikely(pfn >= max_page) || 
+        if ( unlikely(!mfn_valid(mfn)) ||
              unlikely((d = find_domain_by_id(dom)) == NULL) )
             break;
 
-        page = mfn_to_page(pfn);
+        page = mfn_to_page(mfn);
 
         if ( likely(get_page(page, d)) )
         {
@@ -337,7 +337,7 @@ long arch_do_dom0_op(struct dom0_op *op, struct dom0_op *u_dom0_op)
         int i;
         struct domain *d = find_domain_by_id(op->u.getmemlist.domain);
         unsigned long max_pfns = op->u.getmemlist.max_pfns;
-        unsigned long pfn;
+        unsigned long mfn;
         unsigned long *buffer = op->u.getmemlist.buffer;
         struct list_head *list_ent;
 
@@ -350,14 +350,14 @@ long arch_do_dom0_op(struct dom0_op *op, struct dom0_op *u_dom0_op)
             list_ent = d->page_list.next;
             for ( i = 0; (i < max_pfns) && (list_ent != &d->page_list); i++ )
             {
-                pfn = page_to_mfn(list_entry(list_ent, struct page_info, list));
-                if ( put_user(pfn, buffer) )
+                mfn = page_to_mfn(list_entry(list_ent, struct page_info, list));
+                if ( put_user(mfn, buffer) )
                 {
                     ret = -EFAULT;
                     break;
                 }
                 buffer++;
-                list_ent = mfn_to_page(pfn)->list.next;
+                list_ent = mfn_to_page(mfn)->list.next;
             }
             spin_unlock(&d->page_alloc_lock);
 
index 2110e134f18d25a8444f29906a54ab4e6fb7bd4b..843baa9827c0665312cea9261ba50fd6b35ec173 100644 (file)
@@ -644,7 +644,7 @@ int construct_dom0(struct domain *d,
     if ( opt_dom0_translate )
     {
         si->shared_info  = max_page << PAGE_SHIFT;
-        set_pfn_from_mfn(virt_to_maddr(d->shared_info) >> PAGE_SHIFT, max_page);
+        set_gpfn_from_mfn(virt_to_maddr(d->shared_info) >> PAGE_SHIFT, max_page);
     }
 
     si->flags        = SIF_PRIVILEGED | SIF_INITDOMAIN;
@@ -664,7 +664,7 @@ int construct_dom0(struct domain *d,
             mfn = alloc_epfn - (pfn - REVERSE_START);
 #endif
         ((unsigned long *)vphysmap_start)[pfn] = mfn;
-        set_pfn_from_mfn(mfn, pfn);
+        set_gpfn_from_mfn(mfn, pfn);
     }
     while ( pfn < nr_pages )
     {
@@ -677,7 +677,7 @@ int construct_dom0(struct domain *d,
 #define pfn (nr_pages - 1 - (pfn - (alloc_epfn - alloc_spfn)))
 #endif
             ((unsigned long *)vphysmap_start)[pfn] = mfn;
-            set_pfn_from_mfn(mfn, pfn);
+            set_gpfn_from_mfn(mfn, pfn);
 #undef pfn
             page++; pfn++;
         }
index 2bc8bece1a9b10c0b731ae39cf1dd6f071940422..a15caff3907b338bb0e3a74a8a15bc321c51f9cd 100644 (file)
@@ -64,7 +64,7 @@ static void hvm_map_io_shared_page(struct domain *d)
 
     local_flush_tlb_pge();
 
-    mfn = get_mfn_from_pfn(E820_MAP_PAGE >> PAGE_SHIFT);
+    mfn = get_mfn_from_gpfn(E820_MAP_PAGE >> PAGE_SHIFT);
     if (mfn == INVALID_MFN) {
         printk("Can not find E820 memory map page for HVM domain.\n");
         domain_crash_synchronous();
@@ -97,7 +97,7 @@ static void hvm_map_io_shared_page(struct domain *d)
     unmap_domain_page(p);
 
     /* Initialise shared page */
-    mfn = get_mfn_from_pfn(gpfn);
+    mfn = get_mfn_from_gpfn(gpfn);
     if (mfn == INVALID_MFN) {
         printk("Can not find io request shared page for HVM domain.\n");
         domain_crash_synchronous();
@@ -143,7 +143,7 @@ static void hvm_get_info(struct domain *d)
     unsigned long mfn;
     struct hvm_info_table *t;
 
-    mfn = get_mfn_from_pfn(HVM_INFO_PFN);
+    mfn = get_mfn_from_gpfn(HVM_INFO_PFN);
     if ( mfn == INVALID_MFN ) {
         printk("Can not get info page mfn for HVM domain.\n");
         domain_crash_synchronous();
@@ -255,9 +255,9 @@ hvm_copy(void *buf, unsigned long vaddr, int size, int dir)
 
         if (hvm_paging_enabled(current)) {
             gpa = gva_to_gpa(vaddr);
-            mfn = get_mfn_from_pfn(gpa >> PAGE_SHIFT);
+            mfn = get_mfn_from_gpfn(gpa >> PAGE_SHIFT);
         } else
-            mfn = get_mfn_from_pfn(vaddr >> PAGE_SHIFT);
+            mfn = get_mfn_from_gpfn(vaddr >> PAGE_SHIFT);
         if (mfn == INVALID_MFN)
             return 0;
 
index 8e1c31e9e0bd554291ebc91461e9106a6557dba5..010243f6c7029a3363835f9c2503fd536f4e9399 100644 (file)
@@ -1364,7 +1364,7 @@ static int svm_set_cr0(unsigned long value)
     {
         /* The guest CR3 must be pointing to the guest physical. */
         if (!VALID_MFN(mfn = 
-                    get_mfn_from_pfn(v->arch.hvm_svm.cpu_cr3 >> PAGE_SHIFT))
+                    get_mfn_from_gpfn(v->arch.hvm_svm.cpu_cr3 >> PAGE_SHIFT))
                 || !get_page(mfn_to_page(mfn), v->domain))
         {
             printk("Invalid CR3 value = %lx\n", v->arch.hvm_svm.cpu_cr3);
@@ -1557,7 +1557,7 @@ static int mov_to_cr(int gpreg, int cr, struct cpu_user_regs *regs)
              * removed some translation or changed page attributes.
              * We simply invalidate the shadow.
              */
-            mfn = get_mfn_from_pfn(value >> PAGE_SHIFT);
+            mfn = get_mfn_from_gpfn(value >> PAGE_SHIFT);
             if (mfn != pagetable_get_pfn(v->arch.guest_table))
                 __hvm_bug(regs);
             shadow_sync_all(v->domain);
@@ -1570,7 +1570,7 @@ static int mov_to_cr(int gpreg, int cr, struct cpu_user_regs *regs)
              */
             HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR3 value = %lx", value);
             if (((value >> PAGE_SHIFT) > v->domain->max_pages) 
-                    || !VALID_MFN(mfn = get_mfn_from_pfn(value >> PAGE_SHIFT))
+                    || !VALID_MFN(mfn = get_mfn_from_gpfn(value >> PAGE_SHIFT))
                     || !get_page(mfn_to_page(mfn), v->domain))
             {
                 printk("Invalid CR3 value=%lx\n", value);
index b99eddb19fa2335a37849fb33a9432f205a6f24f..01fda3e24dc94633bc33383634726630444c3625 100644 (file)
@@ -968,7 +968,7 @@ vmx_world_restore(struct vcpu *v, struct vmx_assist_context *c)
          * removed some translation or changed page attributes.
          * We simply invalidate the shadow.
          */
-        mfn = get_mfn_from_pfn(c->cr3 >> PAGE_SHIFT);
+        mfn = get_mfn_from_gpfn(c->cr3 >> PAGE_SHIFT);
         if (mfn != pagetable_get_pfn(v->arch.guest_table)) {
             printk("Invalid CR3 value=%x", c->cr3);
             domain_crash_synchronous();
@@ -986,7 +986,7 @@ vmx_world_restore(struct vcpu *v, struct vmx_assist_context *c)
             domain_crash_synchronous();
             return 0;
         }
-        mfn = get_mfn_from_pfn(c->cr3 >> PAGE_SHIFT);
+        mfn = get_mfn_from_gpfn(c->cr3 >> PAGE_SHIFT);
         if(!get_page(mfn_to_page(mfn), v->domain))
                 return 0;
         old_base_mfn = pagetable_get_pfn(v->arch.guest_table);
@@ -1157,7 +1157,7 @@ static int vmx_set_cr0(unsigned long value)
         /*
          * The guest CR3 must be pointing to the guest physical.
          */
-        if ( !VALID_MFN(mfn = get_mfn_from_pfn(
+        if ( !VALID_MFN(mfn = get_mfn_from_gpfn(
             v->arch.hvm_vmx.cpu_cr3 >> PAGE_SHIFT)) ||
              !get_page(mfn_to_page(mfn), v->domain) )
         {
@@ -1232,7 +1232,7 @@ static int vmx_set_cr0(unsigned long value)
 
     if(!((value & X86_CR0_PE) && (value & X86_CR0_PG)) && paging_enabled)
         if(v->arch.hvm_vmx.cpu_cr3) {
-            put_page(mfn_to_page(get_mfn_from_pfn(
+            put_page(mfn_to_page(get_mfn_from_gpfn(
                       v->arch.hvm_vmx.cpu_cr3 >> PAGE_SHIFT)));
             v->arch.guest_table = mk_pagetable(0);
         }
@@ -1366,7 +1366,7 @@ static int mov_to_cr(int gp, int cr, struct cpu_user_regs *regs)
              * removed some translation or changed page attributes.
              * We simply invalidate the shadow.
              */
-            mfn = get_mfn_from_pfn(value >> PAGE_SHIFT);
+            mfn = get_mfn_from_gpfn(value >> PAGE_SHIFT);
             if (mfn != pagetable_get_pfn(v->arch.guest_table))
                 __hvm_bug(regs);
             shadow_sync_all(v->domain);
@@ -1377,7 +1377,7 @@ static int mov_to_cr(int gp, int cr, struct cpu_user_regs *regs)
              */
             HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR3 value = %lx", value);
             if ( ((value >> PAGE_SHIFT) > v->domain->max_pages ) ||
-                 !VALID_MFN(mfn = get_mfn_from_pfn(value >> PAGE_SHIFT)) ||
+                 !VALID_MFN(mfn = get_mfn_from_gpfn(value >> PAGE_SHIFT)) ||
                  !get_page(mfn_to_page(mfn), v->domain) )
             {
                 printk("Invalid CR3 value=%lx", value);
index 41da40e00fc6fa192bc838cb046a57eedb856a24..5af95449c0c77e0f766e7d0e7c366c532f868fd1 100644 (file)
@@ -475,7 +475,7 @@ get_page_from_l1e(
     {
         MEM_LOG("Error getting mfn %lx (pfn %lx) from L1 entry %" PRIpte
                 " for dom%d",
-                mfn, get_pfn_from_mfn(mfn), l1e_get_intpte(l1e), d->domain_id);
+                mfn, get_gpfn_from_mfn(mfn), l1e_get_intpte(l1e), d->domain_id);
     }
 
     return okay;
@@ -1507,7 +1507,7 @@ int get_page_type(struct page_info *page, unsigned long type)
                                 " != exp %" PRtype_info ") "
                                 "for mfn %lx (pfn %lx)",
                                 x, type, page_to_mfn(page),
-                                get_pfn_from_mfn(page_to_mfn(page)));
+                                get_gpfn_from_mfn(page_to_mfn(page)));
                     return 0;
                 }
                 else if ( (x & PGT_va_mask) == PGT_va_mutable )
@@ -1547,7 +1547,7 @@ int get_page_type(struct page_info *page, unsigned long type)
         {
             MEM_LOG("Error while validating mfn %lx (pfn %lx) for type %"
                     PRtype_info ": caf=%08x taf=%" PRtype_info,
-                    page_to_mfn(page), get_pfn_from_mfn(page_to_mfn(page)),
+                    page_to_mfn(page), get_gpfn_from_mfn(page_to_mfn(page)),
                     type, page->count_info, page->u.inuse.type_info);
             /* Noone else can get a reference. We hold the only ref. */
             page->u.inuse.type_info = 0;
@@ -2152,7 +2152,8 @@ int do_mmu_update(
 
         case MMU_MACHPHYS_UPDATE:
 
-            if (shadow_mode_translate(FOREIGNDOM)) {
+            if ( shadow_mode_translate(FOREIGNDOM) )
+            {
                 MEM_LOG("can't mutate m2p table of translate mode guest");
                 break;
             }
@@ -2166,7 +2167,7 @@ int do_mmu_update(
                 break;
             }
 
-            set_pfn_from_mfn(mfn, gpfn);
+            set_gpfn_from_mfn(mfn, gpfn);
             okay = 1;
 
             mark_dirty(FOREIGNDOM, mfn);
@@ -2626,7 +2627,7 @@ long set_gdt(struct vcpu *v,
     struct domain *d = v->domain;
     /* NB. There are 512 8-byte entries per GDT page. */
     int i, nr_pages = (entries + 511) / 512;
-    unsigned long pfn;
+    unsigned long mfn;
 
     if ( entries > FIRST_RESERVED_GDT_ENTRY )
         return -EINVAL;
@@ -2635,9 +2636,9 @@ long set_gdt(struct vcpu *v,
 
     /* Check the pages in the new GDT. */
     for ( i = 0; i < nr_pages; i++ ) {
-        pfn = frames[i] = gmfn_to_mfn(d, frames[i]);
-        if ((pfn >= max_page) ||
-            !get_page_and_type(mfn_to_page(pfn), d, PGT_gdt_page) )
+        mfn = frames[i] = gmfn_to_mfn(d, frames[i]);
+        if ( !mfn_valid(mfn) ||
+             !get_page_and_type(mfn_to_page(mfn), d, PGT_gdt_page) )
             goto fail;
     }
 
@@ -2704,7 +2705,7 @@ long do_update_descriptor(u64 pa, u64 desc)
 
     if ( !VALID_MFN(mfn = gmfn_to_mfn(dom, gmfn)) ||
          (((unsigned int)pa % sizeof(struct desc_struct)) != 0) ||
-         (mfn >= max_page) ||
+         !mfn_valid(mfn) ||
          !check_descriptor(&d) )
     {
         UNLOCK_BIGLOCK(dom);
@@ -2805,8 +2806,8 @@ long arch_memory_op(int op, void *arg)
         }
         UNLOCK_BIGLOCK(d);
 
-        xrpa.first_pfn = d->arch.first_reserved_pfn;
-        xrpa.nr_pfns   = 32;
+        xrpa.first_gpfn = d->arch.first_reserved_pfn;
+        xrpa.nr_gpfns   = 32;
 
         put_domain(d);
 
index 7e98c09a709c24971d0c4f57655bb728c99e4743..a4df3c93243cb0f6bfa0575bd2e37d2edac28e81 100644 (file)
@@ -870,7 +870,7 @@ alloc_p2m_table(struct domain *d)
     {
         page = list_entry(list_ent, struct page_info, list);
         mfn = page_to_mfn(page);
-        pfn = get_pfn_from_mfn(mfn);
+        pfn = get_gpfn_from_mfn(mfn);
         ASSERT(pfn != INVALID_M2P_ENTRY);
         ASSERT(pfn < (1u<<20));
 
@@ -884,7 +884,7 @@ alloc_p2m_table(struct domain *d)
     {
         page = list_entry(list_ent, struct page_info, list);
         mfn = page_to_mfn(page);
-        pfn = get_pfn_from_mfn(mfn);
+        pfn = get_gpfn_from_mfn(mfn);
         if ( (pfn != INVALID_M2P_ENTRY) &&
              (pfn < (1u<<20)) )
         {
@@ -1410,7 +1410,7 @@ int shadow_mode_control(struct domain *d, dom0_shadow_control_t *sc)
 }
 
 unsigned long
-get_mfn_from_pfn_foreign(struct domain *d, unsigned long gpfn)
+get_mfn_from_gpfn_foreign(struct domain *d, unsigned long gpfn)
 {
     unsigned long va, tabpfn;
     l1_pgentry_t *l1, l1e;
@@ -1418,7 +1418,7 @@ get_mfn_from_pfn_foreign(struct domain *d, unsigned long gpfn)
 
     ASSERT(shadow_mode_translate(d));
 
-    perfc_incrc(get_mfn_from_pfn_foreign);
+    perfc_incrc(get_mfn_from_gpfn_foreign);
 
     va = gpfn << PAGE_SHIFT;
     tabpfn = pagetable_get_pfn(d->arch.phys_table);
index d3f5326c576a438031039c8d11828c6e2cd0fb43..29d7a8597999fb3015c706d2855df2b26419c809 100644 (file)
@@ -1397,7 +1397,7 @@ alloc_p2m_table(struct domain *d)
     {
         page = list_entry(list_ent, struct page_info, list);
         mfn = page_to_mfn(page);
-        pfn = get_pfn_from_mfn(mfn);
+        pfn = get_gpfn_from_mfn(mfn);
         ASSERT(pfn != INVALID_M2P_ENTRY);
         ASSERT(pfn < (1u<<20));
 
@@ -1411,7 +1411,7 @@ alloc_p2m_table(struct domain *d)
     {
         page = list_entry(list_ent, struct page_info, list);
         mfn = page_to_mfn(page);
-        pfn = get_pfn_from_mfn(mfn);
+        pfn = get_gpfn_from_mfn(mfn);
         if ( (pfn != INVALID_M2P_ENTRY) &&
              (pfn < (1u<<20)) )
         {
@@ -1599,7 +1599,7 @@ remove_shadow(struct domain *d, unsigned long gpfn, u32 stype)
 }
 
 unsigned long
-get_mfn_from_pfn_foreign(struct domain *d, unsigned long gpfn)
+get_mfn_from_gpfn_foreign(struct domain *d, unsigned long gpfn)
 {
     unsigned long va, tabpfn;
     l1_pgentry_t *l1, l1e;
@@ -1607,7 +1607,7 @@ get_mfn_from_pfn_foreign(struct domain *d, unsigned long gpfn)
 
     ASSERT(shadow_mode_translate(d));
 
-    perfc_incrc(get_mfn_from_pfn_foreign);
+    perfc_incrc(get_mfn_from_gpfn_foreign);
 
     va = gpfn << PAGE_SHIFT;
     tabpfn = pagetable_get_pfn(d->arch.phys_table);
index 334d586e9a089ed7d15888e8cedf359b06a96640..1f5da338ea6963cdd8d89ae8af50e16973158d71 100644 (file)
@@ -108,7 +108,7 @@ void __init paging_init(void)
 
     /* Fill with an obvious debug pattern. */
     for ( i = 0; i < (mpt_size / BYTES_PER_LONG); i++)
-        set_pfn_from_mfn(i, 0x55555555);
+        set_gpfn_from_mfn(i, 0x55555555);
 
     /* Create page tables for ioremap(). */
     for ( i = 0; i < (IOREMAP_MBYTES >> (L2_PAGETABLE_SHIFT - 20)); i++ )
index e3f4527d25210b5f4bcd36a7d4eabcac99089c88..4422ca2530f44d12aaeeddc33aa2b987d7536298 100644 (file)
@@ -84,7 +84,7 @@ void show_page_walk(unsigned long addr)
 #ifdef CONFIG_X86_PAE
     ptab = map_domain_page(mfn);
     ent  = ptab[l3_table_offset(addr)];
-    pfn  = get_pfn_from_mfn((u32)(ent >> PAGE_SHIFT)); 
+    pfn  = get_gpfn_from_mfn((u32)(ent >> PAGE_SHIFT)); 
     printk(" L3 = %"PRIpte" %08lx\n", ent, pfn);
     unmap_domain_page(ptab);
     if ( !(ent & _PAGE_PRESENT) )
@@ -94,7 +94,7 @@ void show_page_walk(unsigned long addr)
 
     ptab = map_domain_page(mfn);
     ent  = ptab[l2_table_offset(addr)];
-    pfn  = get_pfn_from_mfn((u32)(ent >> PAGE_SHIFT));
+    pfn  = get_gpfn_from_mfn((u32)(ent >> PAGE_SHIFT));
     printk("  L2 = %"PRIpte" %08lx %s\n", ent, pfn, 
            (ent & _PAGE_PSE) ? "(PSE)" : "");
     unmap_domain_page(ptab);
@@ -104,7 +104,7 @@ void show_page_walk(unsigned long addr)
 
     ptab = map_domain_page(ent >> PAGE_SHIFT);
     ent  = ptab[l1_table_offset(addr)];
-    pfn  = get_pfn_from_mfn((u32)(ent >> PAGE_SHIFT));
+    pfn  = get_gpfn_from_mfn((u32)(ent >> PAGE_SHIFT));
     printk("   L1 = %"PRIpte" %08lx\n", ent, pfn);
     unmap_domain_page(ptab);
 }
index 3589ede56f2824ce847cda896c9ecff104cb9b5a..340b667459df7e16e2c823e43d3adfb7db6f588b 100644 (file)
@@ -628,11 +628,11 @@ long do_dom0_op(struct dom0_op *u_dom0_op)
     case DOM0_IOMEM_PERMISSION:
     {
         struct domain *d;
-        unsigned long pfn = op->u.iomem_permission.first_pfn;
-        unsigned long nr_pfns = op->u.iomem_permission.nr_pfns;
+        unsigned long mfn = op->u.iomem_permission.first_mfn;
+        unsigned long nr_mfns = op->u.iomem_permission.nr_mfns;
 
         ret = -EINVAL;
-        if ( (pfn + nr_pfns - 1) < pfn ) /* wrap? */
+        if ( (mfn + nr_mfns - 1) < mfn ) /* wrap? */
             break;
 
         ret = -ESRCH;
@@ -641,9 +641,9 @@ long do_dom0_op(struct dom0_op *u_dom0_op)
             break;
 
         if ( op->u.iomem_permission.allow_access )
-            ret = iomem_permit_access(d, pfn, pfn + nr_pfns - 1);
+            ret = iomem_permit_access(d, mfn, mfn + nr_mfns - 1);
         else
-            ret = iomem_deny_access(d, pfn, pfn + nr_pfns - 1);
+            ret = iomem_deny_access(d, mfn, mfn + nr_mfns - 1);
 
         put_domain(d);
     }
index 599bd543a8a87d16f0b741289a13e8df9f24b53e..c419cbcde3c55599e5bf1d960047223d3f839915 100644 (file)
@@ -629,7 +629,6 @@ gnttab_prepare_for_transfer(
     u16            sflags;
     u32            scombo, prev_scombo;
     int            retries = 0;
-    unsigned long  target_pfn;
 
     if ( unlikely((rgt = rd->grant_table) == NULL) ||
          unlikely(ref >= NR_GRANT_ENTRIES) )
@@ -648,14 +647,6 @@ gnttab_prepare_for_transfer(
 
     for ( ; ; )
     {
-        target_pfn = sha->frame;
-
-        if ( unlikely(target_pfn >= max_page ) )
-        {
-            DPRINTK("Bad pfn (%lx)\n", target_pfn);
-            goto fail;
-        }
-
         if ( unlikely(sflags != GTF_accept_transfer) ||
              unlikely(sdom != ld->domain_id) )
         {
index d536519856c24ddd6d053e6b2bb87a1d7aa63019..6f0d6b25cdf5a9aa69c7d00d1b8c15c88ec29f42 100644 (file)
@@ -76,7 +76,7 @@ populate_physmap(
     int           *preempted)
 {
     struct page_info *page;
-    unsigned long    i, j, pfn, mfn;
+    unsigned long    i, j, gpfn, mfn;
 
     if ( !array_access_ok(extent_list, nr_extents, sizeof(*extent_list)) )
         return 0;
@@ -104,18 +104,18 @@ populate_physmap(
 
         mfn = page_to_mfn(page);
 
-        if ( unlikely(__get_user(pfn, &extent_list[i]) != 0) )
+        if ( unlikely(__get_user(gpfn, &extent_list[i]) != 0) )
             goto out;
 
         if ( unlikely(shadow_mode_translate(d)) )
         {
             for ( j = 0; j < (1 << extent_order); j++ )
-                guest_physmap_add_page(d, pfn + j, mfn + j);
+                guest_physmap_add_page(d, gpfn + j, mfn + j);
         }
         else
         {
             for ( j = 0; j < (1 << extent_order); j++ )
-                set_pfn_from_mfn(mfn + j, pfn + j);
+                set_gpfn_from_mfn(mfn + j, gpfn + j);
 
             /* Inform the domain of the new page's machine address. */ 
             if ( __put_user(mfn, &extent_list[i]) != 0 )
@@ -156,10 +156,10 @@ decrease_reservation(
         for ( j = 0; j < (1 << extent_order); j++ )
         {
             mfn = gmfn_to_mfn(d, gmfn + j);
-            if ( unlikely(mfn >= max_page) )
+            if ( unlikely(!mfn_valid(mfn)) )
             {
-                DPRINTK("Domain %u page number out of range (%lx >= %lx)\n",
-                        d->domain_id, mfn, max_page);
+                DPRINTK("Domain %u page number %lx invalid\n",
+                        d->domain_id, mfn);
                 return i;
             }
             
index 99f7c9547428788df810b859d88f6c8cc82fb0a5..7f5fe58261941217490061c7821e0e5f74991458 100644 (file)
@@ -216,7 +216,7 @@ void sort_main_extable(void);
 #define page_info page
 
 // see common/memory.c
-#define set_pfn_from_mfn(x,y)  do { } while (0)
+#define set_gpfn_from_mfn(x,y) do { } while (0)
 
 // see common/keyhandler.c
 #define        nop()   asm volatile ("nop 0")
index 5c39821a3bb7f0dd15620c4bf9c9d88270abc27d..cb09abe00f6e5384690c3fa86283bfdff4a8ce04 100644 (file)
@@ -415,8 +415,8 @@ extern unsigned long lookup_domain_mpa(struct domain *d, unsigned long mpaddr);
 #define VALID_M2P(_e)            (!((_e) & (1U<<63)))
 #define IS_INVALID_M2P_ENTRY(_e) (!VALID_M2P(_e))
 
-#define set_pfn_from_mfn(mfn, pfn) (machine_to_phys_mapping[(mfn)] = (pfn))
-#define get_pfn_from_mfn(mfn)      (machine_to_phys_mapping[(mfn)])
+#define set_gpfn_from_mfn(mfn, pfn) (machine_to_phys_mapping[(mfn)] = (pfn))
+#define get_gpfn_from_mfn(mfn)      (machine_to_phys_mapping[(mfn)])
 
 /* If pmt table is provided by control pannel later, we need __get_user
 * here. However if it's allocated by HV, we should access it directly
index aeb91e42c56a5b57cd84dfba31bd92110fd3df88..797ac4d1f5768816e322fb06002972bf06599cb1 100644 (file)
@@ -25,7 +25,7 @@ int steal_page_for_grant_transfer(
     do {                                                                 \
         SHARE_PFN_WITH_DOMAIN(                                           \
             virt_to_page((char *)(t)->shared + ((i) * PAGE_SIZE)), (d)); \
-        set_pfn_from_mfn(                                                \
+        set_gpfn_from_mfn(                                               \
             (virt_to_maddr((t)->shared) >> PAGE_SHIFT) + (i),            \
             INVALID_M2P_ENTRY);                                          \
     } while ( 0 )
index 2639ccce2f0baa3fa6ff4eb4435d6b55780cc913..db428d617ff15454097271f205c728d1bad158d4 100644 (file)
@@ -154,7 +154,7 @@ extern void hvm_pic_assist(struct vcpu *v);
 extern int cpu_get_interrupt(struct vcpu *v, int *type);
 
 // XXX - think about this, maybe use bit 30 of the mfn to signify an MMIO frame.
-#define mmio_space(gpa) (!VALID_MFN(get_mfn_from_pfn((gpa) >> PAGE_SHIFT)))
+#define mmio_space(gpa) (!VALID_MFN(get_mfn_from_gpfn((gpa) >> PAGE_SHIFT)))
 
 #endif /* __ASM_X86_HVM_IO_H__ */
 
index f6dc75e86f112434573b42d73c493fb2a59eb01b..759e0adb1837e4ea5a63b5b6218b257024f02323 100644 (file)
@@ -262,8 +262,8 @@ int check_descriptor(struct desc_struct *d);
 #define VALID_M2P(_e)            (!((_e) & (1UL<<(BITS_PER_LONG-1))))
 #define IS_INVALID_M2P_ENTRY(_e) (!VALID_M2P(_e))
 
-#define set_pfn_from_mfn(mfn, pfn) (machine_to_phys_mapping[(mfn)] = (pfn))
-#define get_pfn_from_mfn(mfn)      (machine_to_phys_mapping[(mfn)])
+#define set_gpfn_from_mfn(mfn, pfn) (machine_to_phys_mapping[(mfn)] = (pfn))
+#define get_gpfn_from_mfn(mfn)      (machine_to_phys_mapping[(mfn)])
 
 /*
  * The phys_to_machine_mapping is the reversed mapping of MPT for full
@@ -275,8 +275,8 @@ int check_descriptor(struct desc_struct *d);
 #define INVALID_MFN             (~0UL)
 #define VALID_MFN(_mfn)         (!((_mfn) & (1U<<31)))
 
-#define set_mfn_from_pfn(pfn, mfn) (phys_to_machine_mapping[(pfn)] = (mfn))
-static inline unsigned long get_mfn_from_pfn(unsigned long pfn)
+#define set_mfn_from_gpfn(pfn, mfn) (phys_to_machine_mapping[(pfn)] = (mfn))
+static inline unsigned long get_mfn_from_gpfn(unsigned long pfn)
 {
     unsigned long mfn;
     l1_pgentry_t pte;
index 69f310e8953e99c855401d997d2788d1486b8a74..7149e9945d79392a418691e3735d09fcd1889bdc 100644 (file)
@@ -285,19 +285,19 @@ static inline void shadow_mode_disable(struct domain *d)
 
 #define mfn_to_gmfn(_d, mfn)                         \
     ( (shadow_mode_translate(_d))                      \
-      ? get_pfn_from_mfn(mfn)                          \
+      ? get_gpfn_from_mfn(mfn)                          \
       : (mfn) )
 
 #define gmfn_to_mfn(_d, gpfn)                        \
     ({                                                 \
         unlikely(shadow_mode_translate(_d))            \
         ? (likely(current->domain == (_d))             \
-           ? get_mfn_from_pfn(gpfn)                    \
-           : get_mfn_from_pfn_foreign(_d, gpfn))       \
+           ? get_mfn_from_gpfn(gpfn)                    \
+           : get_mfn_from_gpfn_foreign(_d, gpfn))       \
         : (gpfn);                                      \
     })
 
-extern unsigned long get_mfn_from_pfn_foreign(
+extern unsigned long get_mfn_from_gpfn_foreign(
     struct domain *d, unsigned long gpfn);
 
 /************************************************************************/
@@ -471,7 +471,7 @@ static inline void __mark_dirty(struct domain *d, unsigned long mfn)
     ASSERT(d->arch.shadow_dirty_bitmap != NULL);
 
     /* We /really/ mean PFN here, even for non-translated guests. */
-    pfn = get_pfn_from_mfn(mfn);
+    pfn = get_gpfn_from_mfn(mfn);
 
     /*
      * Values with the MSB set denote MFNs that aren't really part of the 
@@ -488,7 +488,7 @@ static inline void __mark_dirty(struct domain *d, unsigned long mfn)
         d->arch.shadow_dirty_count++;
     }
 #ifndef NDEBUG
-    else if ( mfn < max_page )
+    else if ( mfn_valid(mfn) )
     {
         SH_VLOG("mark_dirty OOR! mfn=%lx pfn=%lx max=%x (dom %p)",
                mfn, pfn, d->arch.shadow_dirty_bitmap_size, d);
@@ -567,7 +567,7 @@ update_hl2e(struct vcpu *v, unsigned long va)
     old_hl2e = v->arch.hl2_vtable[index];
 
     if ( (l2e_get_flags(gl2e) & _PAGE_PRESENT) &&
-         VALID_MFN(mfn = get_mfn_from_pfn(l2e_get_pfn(gl2e))) )
+         VALID_MFN(mfn = get_mfn_from_gpfn(l2e_get_pfn(gl2e))) )
         new_hl2e = l1e_from_pfn(mfn, __PAGE_HYPERVISOR);
     else
         new_hl2e = l1e_empty();
@@ -649,7 +649,7 @@ static inline void guest_physmap_add_page(
     shadow_lock(d);
     shadow_sync_and_drop_references(d, mfn_to_page(mfn));
     set_p2m_entry(d, gpfn, mfn, &c1, &c2);
-    set_pfn_from_mfn(mfn, gpfn);
+    set_gpfn_from_mfn(mfn, gpfn);
     shadow_unlock(d);
     domain_mmap_cache_destroy(&c1);
     domain_mmap_cache_destroy(&c2);
@@ -668,7 +668,7 @@ static inline void guest_physmap_remove_page(
     shadow_lock(d);
     shadow_sync_and_drop_references(d, mfn_to_page(mfn));
     set_p2m_entry(d, gpfn, -1, &c1, &c2);
-    set_pfn_from_mfn(mfn, INVALID_M2P_ENTRY);
+    set_gpfn_from_mfn(mfn, INVALID_M2P_ENTRY);
     shadow_unlock(d);
     domain_mmap_cache_destroy(&c1);
     domain_mmap_cache_destroy(&c2);
@@ -894,7 +894,7 @@ static inline void hl2e_propagate_from_guest(
     if ( l2e_get_flags(gpde) & _PAGE_PRESENT )
     {
         mfn = gmfn_to_mfn(d, pfn);
-        if ( VALID_MFN(mfn) && (mfn < max_page) )
+        if ( VALID_MFN(mfn) && mfn_valid(mfn) )
             hl2e = l1e_from_pfn(mfn, __PAGE_HYPERVISOR);
     }
 
@@ -1233,7 +1233,7 @@ static inline unsigned long ___shadow_status(
 static inline unsigned long __shadow_status(
     struct domain *d, unsigned long gpfn, unsigned long stype)
 {
-    unsigned long gmfn = ((current->domain == d)
+    unsigned long mfn = ((current->domain == d)
                           ? gmfn_to_mfn(d, gpfn)
                           : INVALID_MFN);
 
@@ -1241,22 +1241,22 @@ static inline unsigned long __shadow_status(
     ASSERT(gpfn == (gpfn & PGT_mfn_mask));
     ASSERT(stype && !(stype & ~PGT_type_mask));
 
-    if ( VALID_MFN(gmfn) && (gmfn < max_page) &&
+    if ( VALID_MFN(mfn) && mfn_valid(mfn) &&
          (stype != PGT_writable_pred) &&
          ((stype == PGT_snapshot)
-          ? !mfn_out_of_sync(gmfn)
-          : !mfn_is_page_table(gmfn)) )
+          ? !mfn_out_of_sync(mfn)
+          : !mfn_is_page_table(mfn)) )
     {
         perfc_incrc(shadow_status_shortcut);
 #ifndef NDEBUG
         if ( ___shadow_status(d, gpfn, stype) != 0 )
         {
-            printk("d->id=%d gpfn=%lx gmfn=%lx stype=%lx c=%x t=%" PRtype_info " "
-                   "mfn_out_of_sync(gmfn)=%d mfn_is_page_table(gmfn)=%d\n",
-                   d->domain_id, gpfn, gmfn, stype,
-                   mfn_to_page(gmfn)->count_info,
-                   mfn_to_page(gmfn)->u.inuse.type_info,
-                   mfn_out_of_sync(gmfn), mfn_is_page_table(gmfn));
+            printk("d->id=%d gpfn=%lx mfn=%lx stype=%lx c=%x t=%" PRtype_info " "
+                   "mfn_out_of_sync(mfn)=%d mfn_is_page_table(mfn)=%d\n",
+                   d->domain_id, gpfn, mfn, stype,
+                   mfn_to_page(mfn)->count_info,
+                   mfn_to_page(mfn)->u.inuse.type_info,
+                   mfn_out_of_sync(mfn), mfn_is_page_table(mfn));
             BUG();
         }
 
index 5f822ea07b86712c9b2978c30da6978f037b9589..2f12f0676281d555e395527463a0f153a6c0fa34 100644 (file)
@@ -176,7 +176,7 @@ static inline int __entry(
         }
         mfn = entry_get_pfn(*le_e);
         if ( (flag & GUEST_ENTRY) && shadow_mode_translate(d) )
-            mfn = get_mfn_from_pfn(mfn);
+            mfn = get_mfn_from_gpfn(mfn);
         if ( le_p )
             unmap_domain_page(le_p);
         le_p = (pgentry_64_t *)map_domain_page(mfn);
@@ -301,7 +301,7 @@ static inline int  __guest_set_l1e(
                 if (unlikely(!(l2e_get_flags_32(gl2e) & _PAGE_PRESENT)))
                     return 0;
 
-                l1mfn = get_mfn_from_pfn(
+                l1mfn = get_mfn_from_gpfn(
                   l2e_get_pfn(gl2e));
 
                 l1va = (l1_pgentry_32_t *)map_domain_page(l1mfn);
@@ -343,7 +343,7 @@ static inline int  __guest_get_l1e(
                     return 0;
 
 
-                l1mfn = get_mfn_from_pfn(
+                l1mfn = get_mfn_from_gpfn(
                   l2e_get_pfn(gl2e));
                 l1va = (l1_pgentry_32_t *) map_domain_page(l1mfn);
                 if (gl1e)
index 1b1e1db137243fdd17c6ac6a5ae965db9f9fed44..195386a66478ca66fee2316ad59b7efbabc56cb3 100644 (file)
@@ -141,11 +141,11 @@ typedef struct dom0_settime {
 
 typedef struct dom0_getpageframeinfo {
     /* IN variables. */
-    unsigned long pfn;     /* Machine page frame number to query.       */
+    unsigned long mfn;     /* Machine page frame number to query.       */
     domid_t domain;        /* To which domain does the frame belong?    */
     /* OUT variables. */
     /* Is the page PINNED to a type? */
-    uint32_t type;              /* see above type defs */
+    uint32_t type;         /* see above type defs */
 } dom0_getpageframeinfo_t;
 
 /*
@@ -263,7 +263,7 @@ typedef struct dom0_getpageframeinfo2 {
 } dom0_getpageframeinfo2_t;
 
 /*
- * Request memory range (@pfn, @pfn+@nr_pfns-1) to have type @type.
+ * Request memory range (@mfn, @mfn+@nr_mfns-1) to have type @type.
  * On x86, @type is an architecture-defined MTRR memory type.
  * On success, returns the MTRR that was used (@reg) and a handle that can
  * be passed to DOM0_DEL_MEMTYPE to accurately tear down the new setting.
@@ -272,8 +272,8 @@ typedef struct dom0_getpageframeinfo2 {
 #define DOM0_ADD_MEMTYPE         31
 typedef struct dom0_add_memtype {
     /* IN variables. */
-    unsigned long pfn;
-    unsigned long nr_pfns;
+    unsigned long mfn;
+    unsigned long nr_mfns;
     uint32_t      type;
     /* OUT variables. */
     uint32_t      handle;
@@ -300,8 +300,8 @@ typedef struct dom0_read_memtype {
     /* IN variables. */
     uint32_t reg;
     /* OUT variables. */
-    unsigned long pfn;
-    unsigned long nr_pfns;
+    unsigned long mfn;
+    unsigned long nr_mfns;
     uint32_t type;
 } dom0_read_memtype_t;
 
@@ -419,8 +419,8 @@ typedef struct dom0_irq_permission {
 #define DOM0_IOMEM_PERMISSION 47
 typedef struct dom0_iomem_permission {
     domid_t  domain;          /* domain to be affected */
-    unsigned long first_pfn;  /* first page (physical page number) in range */
-    unsigned long nr_pfns;    /* number of pages in range (>0) */
+    unsigned long first_mfn;  /* first page (physical page number) in range */
+    unsigned long nr_mfns;    /* number of pages in range (>0) */
     uint8_t allow_access;     /* allow (!0) or deny (0) access to range? */
 } dom0_iomem_permission_t;
  
index a3a45eb04079dc2b365e31a2fc706abf7077eaa4..3f24bb538611a128d01af030e8cdce0632fd5c71 100644 (file)
@@ -21,12 +21,12 @@ typedef struct xen_memory_reservation {
 
     /*
      * XENMEM_increase_reservation:
-     *   OUT: MFN bases of extents that were allocated
+     *   OUT: MFN (*not* GMFN) bases of extents that were allocated
      * XENMEM_decrease_reservation:
-     *   IN:  MFN bases of extents to free
+     *   IN:  GMFN bases of extents to free
      * XENMEM_populate_physmap:
-     *   IN:  PFN bases of extents to populate with memory
-     *   OUT: MFN bases of extents that were allocated
+     *   IN:  GPFN bases of extents to populate with memory
+     *   OUT: GMFN bases of extents that were allocated
      *   (NB. This command also updates the mach_to_phys translation table)
      */
     unsigned long *extent_start;
@@ -36,7 +36,7 @@ typedef struct xen_memory_reservation {
     unsigned int   extent_order;
 
     /*
-     * Mmaximum # bits addressable by the user of the allocated region (e.g., 
+     * Maximum # bits addressable by the user of the allocated region (e.g., 
      * I/O devices often have a 32-bit limitation even in 64-bit systems). If 
      * zero then the user has no addressing restriction.
      * This field is not used by XENMEM_decrease_reservation.
@@ -111,7 +111,7 @@ typedef struct xen_reserved_phys_area {
     unsigned int idx;
 
     /* Base and size of the specified reserved area. */
-    unsigned long first_pfn, nr_pfns;
+    unsigned long first_gpfn, nr_gpfns;
 } xen_reserved_phys_area_t;
 
 #endif /* __XEN_PUBLIC_MEMORY_H__ */
index 60d123689a93c659d135b75ce6fab63bcf100a81..05a4b106ae79a34c4903bf6d1860067d458b8896 100644 (file)
@@ -114,7 +114,7 @@ PERFCOUNTER_CPU(shadow_get_page_fail,   "shadow_get_page_from_l1e fails")
 PERFCOUNTER_CPU(validate_hl2e_calls,    "calls to validate_hl2e_change")
 PERFCOUNTER_CPU(validate_hl2e_changes,  "validate_hl2e makes changes")
 PERFCOUNTER_CPU(exception_fixed,        "pre-exception fixed")
-PERFCOUNTER_CPU(get_mfn_from_pfn_foreign, "calls to get_mfn_from_pfn_foreign")
+PERFCOUNTER_CPU(get_mfn_from_gpfn_foreign, "calls to get_mfn_from_gpfn_foreign")
 PERFCOUNTER_CPU(remove_all_access,      "calls to remove_all_access")
 PERFCOUNTER_CPU(remove_write_access,    "calls to remove_write_access")
 PERFCOUNTER_CPU(remove_write_access_easy, "easy outs of remove_write_access")